/*
 ============================================================================
 Name        : tp4taller-designer.cpp
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in gttkmm
 ============================================================================
 */

#include "Drop.h"
#include "LevelView.h"
#include "ButtonPanelController.h"
#include "WindowController.h"
#include <gtkmm/window.h>
#include <gtkmm/viewport.h>
#include <gtkmm/box.h>
#include <gtkmm/statusbar.h>
#include <gtkmm/builder.h>
#include <gtkmm/application.h>
#include <iostream>

int main (int argc, char *argv[])
{
	Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
	Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_file("tpfinal-designer.glade");

	Gtk::Window *mainWindow;
	builder->get_widget("mainwindow", mainWindow);
	mainWindow->set_title("Level Designer");
	mainWindow->maximize();

	Gtk::Viewport *viewportLevel;
	builder->get_widget("viewportlevel", viewportLevel);
	LevelView lv;
	viewportLevel->add(lv);

	Gtk::Box *dropPanel;
	builder->get_widget("boxdrops", dropPanel);
	ButtonPanelController dpc(dropPanel);

	Gtk::Box *toolPanel;
	builder->get_widget("boxtools", toolPanel);
	ButtonPanelController tpc(toolPanel);

	Gtk::Statusbar *statusbar;
	builder->get_widget("statusbar", statusbar);

	WindowController wc(mainWindow, &dpc, &lv, &tpc, statusbar);

	app->run(*mainWindow);
	delete mainWindow;
	delete viewportLevel;
	delete dropPanel;
	delete toolPanel;
	delete statusbar;
	return 0;
}
